﻿//-----------------------------------------------------------------------
// <copyright file="Trk.cs" company="MKCoolsoft">
//     Copyright (c) mkcoolsoft. All rights reserved.
// </copyright>
// <author>Mario Kuhl</author>
// <revision>26.01.2014 Initial version</revision>
//-----------------------------------------------------------------------

namespace MKCoolsoft.GPXLib
{
    #region usings

    using System;
    using System.Collections.Generic;
    using System.Xml.Serialization;

    #endregion usings

    /// <summary>
    /// <c>Trk</c> represents a track - an ordered list of points describing a path. 
    /// </summary>
    public class Trk
    {
        #region private fields

        /// <summary>
        /// GPS name of track.
        /// </summary>
        private string nameField;

        /// <summary>
        /// GPS comment for track.
        /// </summary>
        private string cmtField;

        /// <summary>
        /// User description of track.
        /// </summary>
        private string descField;

        /// <summary>
        /// Source of data. Included to give user some idea of reliability 
        /// and accuracy of data.
        /// </summary>
        private string srcField;

        /// <summary>
        /// Links to external information about track.
        /// </summary>
        private List<Link> linkListField;

        /// <summary>
        /// GPS track number.
        /// </summary>
        private string numberField;

        /// <summary>
        /// Type (classification) of track.
        /// </summary>
        private string typeField;

        /// <summary>
        /// You can add extend GPX by adding your own elements from another schema here.
        /// </summary>
        private Extensions extensionsField;

        /// <summary>
        /// A Track Segment holds a list of Track Points which are logically connected in order. 
        /// To represent a single GPS track where GPS reception was lost, or the GPS receiver 
        /// was turned off, start a new Track Segment for each continuous span of track data.
        /// </summary>
        private List<Trkseg> trksegListField;

        #endregion private fields

        #region constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="Trk"/> class.
        /// </summary>
        /// <param name="trackName">Name of the track</param>
        public Trk(string trackName)
        {
            this.nameField = trackName;
            this.extensionsField = new Extensions();
            this.linkListField = new List<Link>();
            this.trksegListField = new List<Trkseg>();
        }

        /// <summary>
        /// Prevents a default instance of the <see cref="Trk"/> class from being created.
        /// This "private" constructor is for hiding the public constructor for 
        /// serialize / deserialize
        /// </summary>
        private Trk() 
        {
        }

        #endregion constructors

        #region public properties

        /// <summary>
        /// Gets or sets the Name of the route.
        /// </summary>
        [XmlElementAttribute("name")]
        public string Name
        {
            get
            {
                return this.nameField;
            }

            set
            {
                this.nameField = value;
            }
        }

        /// <summary>
        /// Gets or sets the Comment of the route.
        /// </summary>
        public string Cmt
        {
            get
            {
                return this.cmtField;
            }

            set
            {
                this.cmtField = value;
            }
        }

        /// <summary>
        /// Gets or sets the Description of the route.
        /// </summary>
        public string Desc
        {
            get
            {
                return this.descField;
            }

            set
            {
                this.descField = value;
            }
        }

        /// <summary>
        /// Gets or sets the "Source of data" of the route.
        /// </summary>
        public string Src
        {
            get
            {
                return this.srcField;
            }

            set
            {
                this.srcField = value;
            }
        }

        /// <summary>
        /// Gets or sets the LinkList.
        /// </summary>
        [XmlElementAttribute("link")]
        public List<Link> LinkList
        {
            get
            {
                return this.linkListField;
            }

            set
            {
                this.linkListField = value;
            }
        }

        /// <summary>
        /// Gets or sets the route Number.
        /// </summary>
        [XmlElementAttribute(DataType = "nonNegativeInteger")]
        public string Number
        {
            get
            {
                return this.numberField;
            }

            set
            {
                this.numberField = value;
            }
        }

        /// <summary>
        /// Gets or sets the Type (classification) of the route.
        /// </summary>
        public string Type
        {
            get
            {
                return this.typeField;
            }

            set
            {
                this.typeField = value;
            }
        }

        /// <summary>
        /// Gets or sets the extension of the route.
        /// </summary>
        public Extensions Extensions
        {
            get
            {
                return this.extensionsField;
            }

            set
            {
                this.extensionsField = value;
            }
        }

        /// <summary>
        /// Gets or sets the track segment point list.
        /// </summary>
        [XmlElementAttribute("trkseg")]
        public List<Trkseg> TrksegList
        {
            get
            {
                return this.trksegListField;
            }

            set
            {
                this.trksegListField = value;
            }
        }

        #endregion public properties
    }
}
